<?php
/**
*
* @package page
* @version $Id: functions_page.php 0 30 dec 2008 17:16:46 Alexander de Jong $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* @package page
*/
class page
{
	function page() {}
	
	function list_db_pages()
	{
		global $db;
	}
	
	function list_file_pages()
	{
		global $phpbb_root_path;
	}
	
	function load_db_page($page_id) 
	{
		
	}
	
	function load_file_page($page_class)
	{
		
	}
	
	function install_page($page_id)
	{
		$type = $this->get_page_place($page_id);
		
		switch($type)
		{
			case 'file':
				return new page_install($page_id, $this->get_page_file_info($page_id));
			break;
			
			case 'db':
				return new page_install($page_id, $this->get_page_db_info($page_id));
			break;
		}
	}
	
	function get_page_db_info($page_id)
	{
		global $db;
	}
	
	function get_page_file_info($page_id)
	{
		global $phpbb_root_path, $phpEx;
		$info_file = "{$phpbb_root_path}includes/lexportal/pages/info/$page_id.$phpEx;";
		
		require_once($info_file);
		
		$eval_str = '$info = new ' . $page_id . '();';
		eval($eval_str);
		return $info->page();
	}
	
	function get_page_place($page_id)
	{
		global $phpbb_root_path;
		
		if(is_dir("{$phpbb_root_path}includes/lexportal/pages/$page_id"))
		{
			return 'file';
		}
		else
		{
			return 'db';
		}
	}
}

class page_install extends page
{
	function page_install($page_id, $page_info)
	{
		$type = $this->get_page_place($page_id);
		
		switch($type)
		{
			case 'file':
				return $this->_install_file($page_id, $page_info);
			break;
			
			case 'db':
				return $this->_install_db($page_id, $page_info);
			break;
		}
	}
	
	function _install_file($page_id, $page_info)
	{
		
	}
}

?>